package com.joker.search.server.controller;


import com.joker.common.core.domain.Result;
import com.joker.search.server.service.ProductService;
import com.joker.search.server.vo.SearchParam;
import com.joker.search.server.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("/search")
public class EsSearchController
{


    @Autowired
    private ProductService productService;

    @GetMapping("/product")
    public Result<SearchResult> searchProduct(SearchParam searchParam)throws IOException{
        SearchResult result = productService.search(searchParam);
        return Result.success(result);
    }
}
